package unit4;

import java.util.Date;
public class Ex4_15_DataTest {
    public static void main(String[] args) {
        DateTimeDisply objDateTime = new DateTimeDisply();
        objDateTime.display();
    }
}
class DateTimeDisply {
    Date objDate;
    DateTimeDisply() {
        objDate = new Date();
    }
    void display() {
        String strDate, strTime = "";
        System.out.println("今天的日期是： " + objDate);
        long time = objDate.getTime();
        System.out.println("自 1970 年 1 月 1 日起" +
                           "以毫秒为单位的时间 (GMT)：" + time);
        strDate = objDate.toString();
        strTime = strDate.substring(11, (strDate.length() - 4));
        strTime = "时间： " + strTime.substring(0, 8);
        System.out.println(strTime);
    }
}
